import { post } from 'utils/fetch';


// 列表查询接口
export const getEntrustList = ({ entrustName, trustee, status, startUpdateTime, endUpdataTime, flowName, pageNum, pageSize }) => {
  return post(`/flow-platform/entrust/selectByCondition`, { entrustName, trustee, status, startUpdateTime, endUpdataTime, flowName, pageNumber: pageNum, pageSize });
}
// 我的代办接口
export const getTodoList = ({ pageNum, pageSize, applyUserName, modelName, serialNum, taskName }) => {
  return post(`/flow-platform/process/todo`, { pageNum, pageSize, applyUserName, modelName, serialNum, taskName });
}

// 委托新增和更新接口
export const addEntrust = ({ id, code, description, entrustExist, entrustName, flowEntrustDetailVoList, isdefault, status, trustee, trusteeCode, trusteeDepartment, trusteeDepartmentCode, entrustReason  }) => {
  return post(`/flow-platform/entrust/addOrUpdate`, { id, code, description, entrustExist, entrustName, flowEntrustDetailVoList, isdefault, status, trustee, trusteeCode, trusteeDepartment, trusteeDepartmentCode, entrustReason });
}

// 委托详情接口
export const getEntrustById = ({ id }) => {
  return post(`/flow-platform/entrust/selectByClient`, { id, status: -1 });
}

// 删除列表页面委托
export const deleteEntrustById = ({ id, isDefault }) => {
  return post(`/flow-platform/entrust/deleteEntrustOrDetail`, { id, isDefault });
}

// 删除详情页面自定义委托
export const deleteDetailData = ({ ids }) => {
  return post(`/flow-platform/entrust/deleteDetailData`, { ids });
}

// 更改默认委托和自定义委托的状态
export const updateEntrustStatusById = ({ id, isDefault, status }) => {
  return post(`/flow-platform/entrust/updateStatus`, { id, isDefault, status });
}

// 待办委派
export const entrustTask = (data) => {
  return post(`/flow-platform/task/entrustTask`, data);
}

// 获取流程模型列表数据
export const getListDataForEntrust = (params) => {
  return post('/flow-platform/model/listForEntrust', params);
}